#!/bin/bash

set -e
cd "$(dirname "$0")"

MYSQL="mysql --line-numbers --default-character-set=utf8"
IMPORT="mysqlimport --local --default-character-set=utf8"

# database/user
for f in \
  00-database.sql \
  01-user.sql \
  ; do
    echo "root ... $f"
    $MYSQL -u root < "$f"
done

# fez_movie
for f in \
  10-table.sql \
  ; do
    echo "fez_movie ... $f"
    $MYSQL -u fez_movie fez_movie < "$f"
done

# fez_movie
for f in \
  11-table-index.sql \
  ; do
    echo "fez_movie ... $f"
    $MYSQL -u fez_movie fez_movie < "$f"
done

# fez_movie
for f in \
  20-data.sql \
  ; do
    echo "fez_movie ... $f"
    $MYSQL -u fez_movie fez_movie < "$f"
done

# fez_movie
for f in \
  !dummy-data.sql \
  ; do
    echo "fez_movie ... $f"
    $MYSQL -u fez_movie fez_movie < "$f"
done